import Vue from 'vue'
import VueRouter from 'vue-router'

import Index from '@/components/Index'
import Detail from '@/components/Detail'

Vue.use(VueRouter)

/**
 * 这边为什么不到处vue-router的实例？
 * 因为用户请求都需要创建router实例，防止污染
 * @returns 
 */
export default function createRouter() {
    return new VueRouter({
        mode: 'history',
        routes: [
            { path: '/', component: Index },
            { path: '/detail', component: Detail }
        ]
    })
}